<!-- views/user/Form.vue -->
<template>
    <el-form :model="form">
        <el-form-item label="用户名">
            <el-input v-model="form.username" />
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @click="submit">提交</el-button>
        </el-form-item>
    </el-form>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()
const form = ref({ username: '' })

const submit = () => {
    axios.post('/api/user', form.value).then(() => router.back())
}
</script>